const newsModal = require('../models/News');

module.exports = function ({ router, baseUrl }) {
    router.get(baseUrl + '/news_detail', async (ctx, next) => {
        // console.log(ctx.request.query.id)
        try {
            let reses = await Promise.all([
                newsModal.getDetail(ctx.request.query.id),
            ])
            ctx.render('news-detail/news-detail.pug', { data: reses[0], baseUrl, ssr: true });
        } catch (err) {
            // console.log(err)
            next(err);
        }
    });
}